FROM docker.unsee.tech/pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel
 
ENV LANG="C.UTF-8"
ENV PIP_ROOT_USER_ACTION=ignore
ENV DEBIAN_FRONTEND=noninteractive
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

WORKDIR /app

RUN ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

RUN sed -i "s/archive.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list
RUN apt update && apt install -y --no-install-recommends vim iputils-ping net-tools curl wget libgl1 && apt-get install -y --no-install-recommends ibglib2.0-0 libsm6 libxrender1 libxext6 && apt clean && rm -rf /var/lib/apt/lists/*

COPY nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-11.8_1.0-1_amd64.deb .

RUN dpkg -i nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-11.8_1.0-1_amd64.deb && rm nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-11.8_1.0-1_amd64.deb && apt clean && rm -rf /var/lib/apt/lists/* && cp /var/nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-11.8/nv-tensorrt-local-0628887B-keyring.gpg /usr/share/keyrings/cuda-archive-keyring.gpg

COPY requirements.txt .

RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip install --no-cache-dir -r requirements.txt

COPY ffmpeg /mnt

# export PATH=/mnt:$PATH
ENV PATH=/mnt:$PATH
RUN chmod +x /mnt/* && ln -s /mnt/ffmpeg /ffmpeg
